# $Id: PKGBUILD 88683 2013-04-21 22:16:53Z heftig $
# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gnome-applets
pkgver=3.5.92
pkgrel=3
pkgdesc="Small applications for the GNOME panel"
arch=('i686' 'x86_64')
license=('GPL')
depends=('cpupower' 'gucharmap' 'gstreamer0.10-base-plugins' 'gnome-panel' 'libgtop' 'upower')
makedepends=('gnome-common' 'gnome-doc-utils' 'intltool' 'networkmanager' 'rarian')
url="https://live.gnome.org/GnomeApplets"
install=$pkgname.install
source=(http://download.gnome.org/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz
        gnome-applets-cpupower.patch
        disable-gweather-applet.patch
        fix-autoconf.patch
        01_battstat_upower.patch)
sha256sums=('f6178cb702a39a4103fcb97e9a266bf6d05f05ac5064818f119c023d76170e83'
            '942276d7cc18224d9f5b1b57314746ad4d713ee0dcf4aedb25fa72e92db75e65'
            '47f6b477c0f76ebb1e8ffc6fe9bd2fac9ac7f511f059cf4bb2687f8425bfb4a8'
            '0acd58aee458345e378d5f77256e04b13e3a4c06b166aac390a92309b864e8a4'
            '364c9264c76721b42e85eecc48443852ead1bd730d9de937dd2ae00889db836a')

build() {
  cd "$pkgname-$pkgver"

  sed -i 's@^#!.*python$@#!/usr/bin/python2@' invest-applet/invest/*

  # Use cpupower instead of cpufreq
  patch -Np1 -i "$srcdir/gnome-applets-cpupower.patch"

  # Add UPower support
  patch -Np1 -i "$srcdir/01_battstat_upower.patch"

  # Disable gweather applet, because it's not compatible with libgweather 3.8
  patch -Np1 -i "$srcdir/disable-gweather-applet.patch"

  # Fix build
  patch -Np1 -i "$srcdir/fix-autoconf.patch"

  # Turn off unneeded warnings
  CFLAGS="$CFLAGS -w"

  autoreconf -fi
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib/$pkgname \
              --disable-static --disable-schemas-install --disable-scrollkeeper \
              --enable-mixer-applet \
              PYTHON=/usr/bin/python2
  make
}

package() {
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install

  mkdir -m755 -p "$pkgdir/usr/share/gconf/schemas"
  gconf-merge-schema "$pkgdir/usr/share/gconf/schemas/$pkgname.schemas" "$pkgdir"/etc/gconf/schemas/*.schemas
  rm -r "$pkgdir"/etc/gconf
}
